/*
*  Copyright 2019-2023 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.yangxu.hospital.system.modules.system.service;

import com.yangxu.hospital.common.utils.PageResult;
import com.yangxu.hospital.system.modules.system.domain.Menu;
import com.yangxu.hospital.system.modules.system.domain.SysDepartment;
import com.yangxu.hospital.system.modules.system.domain.vo.MenuQueryCriteria;
import com.yangxu.hospital.system.modules.system.domain.vo.SysDepartmentQueryCriteria;

import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yangxu.hospital.system.modules.system.domain.vo.SysDoctorQueryCriteria;

/**
* @description 服务接口
* @author 杨旭
* @date 2024-11-25
**/
public interface SysDepartmentService extends IService<SysDepartment> {


    /**
     * 查询全部数据
     * @param criteria 条件
     * @param isQuery /
     * @throws Exception /
     * @return /
     */
    List<SysDepartment> queryAll(SysDepartmentQueryCriteria criteria, Boolean isQuery) throws Exception;


    /**
    * 查询数据分页
    * @param criteria 条件
    * @param page 分页参数
    * @return PageResult
    */
//    PageResult<SysDepartment> queryAll(SysDepartmentQueryCriteria criteria, Page<Object> page);

    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<SysDepartmentDto>
    */
    List<SysDepartment> queryAll(SysDepartmentQueryCriteria criteria);

    /**
    * 创建
    * @param resources /
    */
    void create(SysDepartment resources);

    /**
    * 编辑
    * @param resources /
    */
    void update(SysDepartment resources);

    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(List<Long> ids);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<SysDepartment> all, HttpServletResponse response) throws IOException;

    List<SysDepartment> getDepartment(Long pid);

    /**
     * 根据ID查询
     * @param id /
     * @return /
     */
    SysDepartment findById(Long id);


    /**
     * 根据ID获取同级与上级数据
     * @param menu /
     * @param objects /
     * @return /
     */
    List<SysDepartment> getSuperior(SysDepartment menu, List<SysDepartment> objects);

    /**
     * 构建菜单树
     * @param sysDepartment 原始数据
     * @return /
     */
    List<SysDepartment> buildTree(List<SysDepartment> sysDepartment);


    /**
     * 获取所有子节点，包含自身ID
     * @param department /
     * @param sysDepartments /
     * @return /
     */
    Set<SysDepartment> getchildDepartment(List<SysDepartment> department, Set<SysDepartment> sysDepartments);

    void delete(Set<SysDepartment> sysDepartmentSet);
}